package org.jim.core.packets;

/**
 * @ProjectName: jim
 * @Package: org.jim.core.packets
 * @ClassName: GeneralMsgBody
 * @Description: java类作用描述
 * @Author: wmt
 * @CreateDate: 2020/6/17 15:46
 * @UpdateUser: 更新者
 * @UpdateDate: 2020/6/17 15:46
 * @UpdateRemark: 更新说明
 * @Version: 1.0
 */
public class GeneralMsgBody extends Message {

    private static final long serialVersionUID = -1282561591351719291L;
    /**
     * 发送用户id;
     */
    private String from;
    /**
     * 消息类型;(如：0:text、1:image、2:voice、3:vedio、4:music、5:news)
     */
    private Integer msgType;

    /**
     * 聊天类型;(如公聊、私聊)
     */
    private Integer chatType;
    /**
     * 事件id
     */
    private Integer instruct;
    /**
     * 消息发到哪个群组;
     */
    private String groupId;

    /**
     * 扩展参数字段
     */
    private String expand;

    /**
     * 绑定/解散/被踢出群组的用户id
     */
    private String userId;

    /**
     * 客户端的消息id
     */
    private String localId;


    private GeneralMsgBody(){}

    public GeneralMsgBody(String from, Integer msgType, Integer chatType, Integer instruct, String groupId, String expand,String userId,String localId) {
        this.from = from;
        this.msgType = msgType;
        this.chatType = chatType;
        this.instruct = instruct;
        this.groupId = groupId;
        this.expand = expand;
        this.userId = userId;
        this.localId = localId;
    }

    public static GeneralMsgBody.Builder newBuilder(){
        return new GeneralMsgBody.Builder();
    }

    public String getFrom() {
        return from;
    }

    public GeneralMsgBody setFrom(String from) {
        this.from = from;
        return this;
    }

    public Integer getInstruct() {
        return instruct;
    }

    public void setInstruct(Integer instruct) {
        this.instruct = instruct;
    }

    public String getExpand() {
        return expand;
    }

    public void setExpand(String expand) {
        this.expand = expand;
    }

    public Integer getMsgType() {
        return msgType;
    }

    public GeneralMsgBody setMsgType(Integer msgType) {
        this.msgType = msgType;
        return this;
    }
    public String getGroupId() {
        return groupId;
    }

    public void setGroupId(String groupId) {
        this.groupId = groupId;
    }

    public Integer getChatType() {
        return chatType;
    }

    public GeneralMsgBody setChatType(Integer chatType) {
        this.chatType = chatType;
        return this;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getLocalId() {
        return localId;
    }

    public void setLocalId(String localId) {
        this.localId = localId;
    }

    public static class Builder extends Message.Builder<GeneralMsgBody,GeneralMsgBody.Builder>{
        /**
         * 来自user_id;
         */
        private String from;
        /**
         * 消息类型;(如：0:text、1:image、2:voice、3:vedio、4:music、5:news)
         */
        private Integer msgType;
        /**
         * 聊天类型;(如公聊、私聊)
         */
        private Integer chatType;
        /**
         * 事件id
         */
        private Integer instruct;
        /**
         * 消息发到哪个群组;
         */
        private String groupId;
        /**
         * 扩展参数字段
         */
        protected String expand;
        /**
         * 绑定/解散/被踢出群组/离开房间的用户id
         */
        private String userId;

        /**
         * 客户端消息id
         */
        private String localId;

        public Builder(){};

        public GeneralMsgBody.Builder from(String from) {
            this.from = from;
            return this;
        }
        public GeneralMsgBody.Builder msgType(Integer msgType) {
            this.msgType = msgType;
            return this;
        }
        public GeneralMsgBody.Builder chatType(Integer chatType) {
            this.chatType = chatType;
            return this;
        }
        public GeneralMsgBody.Builder groupId(String groupId) {
            this.groupId = groupId;
            return this;
        }
        public GeneralMsgBody.Builder userId(String userId) {
            this.userId = userId;
            return this;
        }
        public GeneralMsgBody.Builder localId(String localId) {
            this.localId = localId;
            return this;
        }

        @Override
        protected GeneralMsgBody.Builder getThis() {
            return this;
        }

        @Override
        public GeneralMsgBody build() {
            return null;
        }
    }
}
